package com.fanyouzhao.ehome2.core.pojo;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.*;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.Date;

/**
 * @Author: fanyouzhao
 * @Date: 14:46 2021/5/8
 */
@Data
@ToString(exclude = {"pwd","salt"})
@AllArgsConstructor
@NoArgsConstructor
@Table(name = "tb_admin")
public class Admin implements Serializable {
    // 主键策略
    @Id
    // 设置id为自增策略（可以省略，主键默认自增）
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "admin_id")
    private Integer id;
    @Column(name = "admin_name")
    private String name;
    @Column(name = "admin_pwd")
    /*@JsonIgnore是jackson的注解，@JSONField(serialize = false)是FastJson的注解。
    SprintMVC默认是通过jackson来转换JSON的，@JsonIgnore*/
    @JsonIgnore
    private String pwd;
    @Column(name = "admin_salt")
    @JsonIgnore
    private String salt;
    @Column(name = "admin_phone")
    private String phone;
    @Column(name = "admin_regTime")
    @JsonFormat(pattern = "YYYY-MM-dd HH:mm:ss")
    private Timestamp regTime;
}
